#!/bin/bash
if [ -n "$1" ]
then
do_date=$1
else
do_date=`date -d "-1 day" +%F`
fi


sql="
insert overwrite table ads.ads_member_7d3cont_active
select count(*), '$do_date'
from dws.dws_member_7d_cont_active
where cont_num>=3 and dt='$do_date';
"
hive -e "$sql"